
use global_BLAs_09_21_21, clear

drop if year<1945 | year>2021

*Unique dyad
egen udyad = tag(dyad_id)

*Time periods
gen time_int = ceil((year-1945)/10)

*Language
gen code_language = 1 if doc_language=="English" & copyavailable==1 & google_translate==0
replace code_language = 2 if google_translate==1 & copyavailable==1 & !regexm(doc_language, "Spanish") ///
	& !regexm(doc_language, "Portugese") & !regexm(doc_language, "Arabic")
replace code_language = 3 if copyavailable==1 & regexm(doc_language, "Arabic")
replace code_language = 4 if copyavailable==1 & regexm(doc_language, "Spanish")
replace code_language = 5 if copyavailable==1 & regexm(doc_language, "Portugese")
replace code_language = 6 if copyavailable==1 & missing(code_language)


*7) Treaty languages over time

#delimit ;

graph bar (count) copyavailable, over(code_lang) over(time_int, relabel (1 "1946-1955" 2 "1956-1965"
	3 "1966-1975" 4 "1976-1985" 5 "1986-1995" 6 "1996-2005" 7 "2006-2015" 8 "2016-2020") 
	label(labsize(*0.65) angle(0))) stack percent asyvar ylab(#10, angle(0) labsize(*0.8))
	legend(order(1 "English (original or official translation)" 2 "English (Google Translate)" 
	3 "Arabic" 4 "Spanish" 5 "Portugese" 6 "Other") rows(3) size(*0.8))
	bar(1, c(gs3)) bar(2, c(gs5)) bar(3, c(gs7)) bar(4, c(gs9)) bar(5, c(gs11))
	bar(6, c(gs13)) yt("") graphregion(color(white)) name(doc_lang_by_period, replace);

#delimit cr
	